home *** CD-ROM | disk | FTP | other *** search
- LDOPEN(3X) Last changed: 1-8-99
-
-
- NNAAMMEE
- llddooppeenn, llddaaooppeenn - Opens a common object file for reading
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssttddiioo..hh>>
- ##iinncclluuddee <<ffiilleehhddrr..hh>>
- ##iinncclluuddee <<ssyymmss..hh>>
- ##iinncclluuddee <<llddffccnn..hh>>
-
- LLDDFFIILLEE **llddooppeenn (("_f_i_l_e_n_a_m_e,,llddppttrr""))
- cchhaarr **_f_i_l_e_n_a_me;;
- LLDDFFIILLEE **_l_d_p_t_r;;
-
- LLDDFFIILLEE **llddaaooppeenn (("_f_i_l_e_n_a_m_e,,oollddppttrr""))
- cchhaarr **_f_i_l_e_n_a_m_e;;
- LLDDFFIILLEE **_o_l_d_p_t_r;;
-
- iinntt llddrreeaaddsstt (("_l_d_p_t_r,,ffllaaggss""))
- LLDDFFIILLEE **_l_d_p_t_r;;
- iinntt _f_l_a_g_s;
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems (o32 ABI only)
-
- DDEESSCCRRIIPPTTIIOONN
- llddooppeenn and llddcclloossee(3X) provide uniform access to simple object files
- and to object files that are members of archive files. An archive of
- common object files can be processed as if it were a series of simple
- common object files.
-
- If _l_d_p_t_r has the value NNUULLLL, llddooppeenn opens _f_i_l_e_n_a_m_e, allocates and
- initializes the LLDDFFIILLEE structure, and returns a pointer to the
- structure to the calling program.
-
- If _l_d_p_t_r is valid and TTYYPPEE((_l_d_p_t_r)) is the archive magic number, llddooppeenn
- reinitializes the LLDDFFIILLEE structure for the next archive member of
- _f_i_l_e_n_a_m_e.
-
- llddooppeenn and llddcclloossee work in concert. llddcclloossee returns FFAAIILLUURREE only when
- TTYYPPEE((_l_d_p_t_r)) is the archive magic number and there is another file in
- the archive to be processed. Only then should llddooppeenn be called with
- the current value of _l_d_p_t_r. In all other cases, and particularly when
- a new _f_i_l_e_n_a_m_e is opened, llddooppeenn should be called with a NNUULLLL _l_d_p_t_r
- argument.
-
- The following is a prototype for the use of llddooppeenn and llddcclloossee. It
- handles individual object (or aa..oouutt) files and (via the wwhhiillee--lloooopp) an
- archive file [see aarr(1)] of object files.
-
- /* for each filename to be processed */
-
- ldptr = NULL;
- do {
- if ( (ldptr = ldopen(filename, ldptr)) != NULL )
- {
- /* check magic number */
- /* process a single object file */
- }
- } while (ldclose(ldptr) == FAILURE );
-
- If the value of _o_l_d_p_t_r is not NNUULLLL, llddaaooppeenn opens _f_i_l_e_n_a_m_e anew and
- allocates and initializes a new LLDDFFIILLEE structure, copying the fields
- from _o_l_d_p_t_r. llddaaooppeenn returns a pointer to the new LLDDFFIILLEE structure.
- This new pointer is independent of the old pointer, _o_l_d_p_t_r. The two
- pointers can be used concurrently to read separate parts of the object
- file. For example, one pointer can be used to step sequentially
- through the relocation information while the other is used to read
- indexed symbol table entries.
-
- llddooppeenn and llddaaooppeenn open _f_i_l_e_n_a_m_e for reading. If _f_i_l_e_n_a_m_e cannot be
- opened or if memory for the LLDDFFIILLEE structure cannot be allocated, both
- functions return NNUULLLL. A successful open does not ensure that the
- given file is a common object file or an archived object file. When
- calling llddooppeenn on a given aa..oouutt (rather than an archive) for the first
- time be sure the second argument you pass is a NULL pointer [(LDFILE
- *)0] (this is the only way to ensure the LLDDFFIILLEE ** is initialized
- properly for that aa..oouutt file).
-
- llddrreeaaddsstt reads in the portions of the symbol table implied by the
- _f_l_a_g_s argument. A _f_l_a_g_s argument of --11 reads in the entire symbol
- table. Because the other routines, for example, llddttbbrreeaadd, ensure that
- the relevant portions of the symbol table have been read in, you need
- not call llddrreeaaddsstt to use the other routines. llddrreeaaddsstt((llddppttrr,,--11)) would
- simply ensure the whole symbol table is read in at once, which is not
- necessary. llddrreeaaddsstt returns SSUUCCCCEESSSS if it has read in the symbol
- table successfully or FFAAIILLUURREE if it cannot. If a symbol table has
- been truncated or damaged, there is a small probability that llddrreeaaddsstt
- will core dump rather than return FFAAIILLUURREE.
-
- llddooppeenn causes the symbol table header and file descriptor table to be
- read. Further access, using _l_d_p_t_r, causes other appropriate sections
- of the symbol table to be read (for example, if you call llddttbbrreeaadd,, tthhee
- ssyymmbboollss oorr eexxtteerrnnaallss aarree rreeaadd)).. TToo ffoorrccee sseeccttiioonnss ooff tthhee ssyymmbbooll ttaabbllee
- iinnttoo mmeemmoorryy,, ccaallll llddrreeaaddsstt wwiitthh SSTT__PP** ccoonnssttaannttss OORReedd ttooggeetthheerr ffrroomm
- <<ccmmppllrrss//ssttssuuppppoorrtt..hh>>..
-
- The program must be loaded with the object file access routine library
- lliibbmmlldd..aa.
-
- The iinnttrroo(4) man page describes IINNCCDDIIRR and LLIIBBDDIIRR.
-
- SSEEEE AALLSSOO
- ffooppeenn(3S), llddcclloossee(3X)
-
- iinnttrroo(4), llddffccnn(4)
-
- This man page is available only online.
-